import subprocess
#
subprocess.run('ls')
subprocess.run(['ls', '/opt'])
subprocess.run('echo $HOME', shell=True)

def ping(host):
    result = subprocess.run(f'ping -c 3 {host} &> /dev/null', shell=True)
    if result.returncode == 0:
        print(f'{host}:up')
    else:
        print(f'{host}:down')

if __name__ == '__main__':
    # ping('192.168.88.130')
    # ping('127.0.0.1')
    hosts = ['www.js.com', '192.168.1.1', '127.0.0.1']
    for item in hosts:
        ping(item)

